<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%String path = request.getContextPath();%>
<script type="text/javascript" src="<%=path%>/static/js/jquery-1.8.2.min.js"></script>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <script src="<%=path%>/static/js/path.js"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>i学习</title>
    <link rel="stylesheet" href="<%=path%>/static/css/base.css">
    <link rel="stylesheet" href="<%=path%>/static/css/homeindex.css">
    <link rel="stylesheet" href="<%=path%>/static/css/home.css">
    <link rel="stylesheet" href="<%=path%>/static/css/audit.css">
    <script src="<%=path%>/static/js/head.js"></script>
</head>
<body>

<div id="vue_body">

    <!-- 顶部   -->
    <div class="header">
        <div class="width_1200 clearfix">
            <div class="header_right right_f">
                你好
                <div class="item uname" v-if="user"><c:if test="${sessionScope.user==null}"><a href="login.jsp">请登录</a></c:if>
                    <c:if test="${sessionScope.user!=null}"><a href="homePage.jsp">,${sessionScope.user.userName}!</a></c:if></div>
                <div class="item">欢迎来到i学习！</div>
                <div class="item" ><a href="registration.jsp">[注册]</a></div>
                <div class="item" onclick="exitLogin()">退出</div>
                <div class="item service">客服中心</div>
            </div>

        </div>
    </div>

</div>
<!-- 内容   -->
<div class="logobox width_1200" style="margin-left: 10%">
    <div class="logo left_f">
        <a href="<%=path%>/index?action=getshowlist"><img src="<%=path%>/static/img/logo.jpeg" width="60" height="120"></a>
    </div>
    <div class="searchbox left_f">
        <div class="input clearfix">
            <form action="<%=path%>/index?action=getlistbyname" method="post">
                <input type="text"  style="width: 418px;font-size: 16px" name="videoname" placeholder="请输入关键词">
                <span><input style="margin-left: 66px; text-index:0px;width: 110px;font-size: 22px;border:#000000 2px solid" type="submit" value="站内搜索"></span>
            </form>
        </div>

    </div>

    <a class="myclass left_f" rel="nofollow"
       href="<%=path%>/uploadServlet?action=going" onclick="return uploadex()"> <span class="icons"></span>我要上传</a>

</div>
</div>

<hr style="width:100%;height:3px;">
<div>
<div class="i_bg bg_color">
    <div class="m_content">
        <div class="m_left">
            <div class="left_n">管理中心</div>
            <div class="left_m">
                <div class="left_m_t t_bg1"><a href="<%=path%>/userServlet?action=personInfo">个人中心</a></div>
            </div>
            <div class="left_m">
                <div class="left_m_t t_bg2"><a href="<%=path%>/Comment?action=getCommentByUser">我的评论</a>
                </div>
            </div>
            <div class="left_m">
                <div class="left_m_t t_bg3"><a href="<%=path%>/Watch?action=getWatchlist">观看历史</a></div>
            </div>
            <div class="left_m">
                <div class="left_m_t t_bg1"><a href="<%=path%>/uploadServlet?action=going">我要上传</a></div>
            </div>
            <c:if test="${sessionScope.user.userType>2}">
                <div class="left_m">
                    <div class="left_m_t t_bg4"><a href="<%=path%>/userServlet?action=userManage">用户管理</a></div>
                </div>
                <div class="left_m">
                    <div class="left_m_t t_bg5"><a href="<%=path%>/uploadServlet?action=getList">视频审核</a></div>
                </div>
            </c:if>
        </div>
        <div class="m_right">
            <div class="m_des">
                <table  cellspacing="0" cellpadding="0">
                    <caption style="margin-bottom:1%;color: crimson" ><h2>资 源 审 核</h2></caption>
                    <form action="<%=path%>/index?action=insertVideo" enctype="multipart/form-data" id="uplo" method="post">
                    <tr >
                        <td>资源名称：</td>  <td style=" margin-left: 80px;" ><input style=" margin-left: 80px;" type="text" name="name" value="${requestScope.upload.videoName}">
                        <a href="static/audit/${requestScope.upload.videoName}" target="_blank"><input style=" margin-left: 80px;" type="button" name="name" value="预览"></a></td>
                    </tr><tr>
                        <td>资源类别：</td>  <td style=" margin-left: 80px;" ><select style=" margin-left: 80px;" name="type" id="type" ><option  value="1" selected>JAVA</option>
                        <option value="2" >JQuerry</option>
                        <option value="3" >JavaScript</option>
                        <option value="4" >HTML</option></select></td>
                    </tr><tr>
                        <td>视频图片：</td>  <td style=" margin-left: 80px;"><input  style=" margin-left: 80px; border: darkgray 1px solid; " name="picture" type="file" id="picture"  accept=".jpg" onchange="upload11()"/></td>
                    </tr><tr>
                    <td>上传者：</td>  <td  style=" margin-left: 80px;" ><input  style=" margin-left: 80px;"type="text" name="upuser" value="${requestScope.upload.videoUploadUser}"></td>
                </tr><tr style="display:none">
                        <td>上传者id：</td> <td  style=" margin-left: 80px;"><input style=" margin-left: 80px;" type="text" name="upuserid" value="${requestScope.upload.userId}"></td>
                        </tr>
                        <tr style="display:none">
                            <td>资源id：</td>  <td  style=" margin-left: 80px;" ><input  style=" margin-left: 80px;"type="text" name="upid" value="${requestScope.upload.videoId}"></td>
                        </tr><tr>
                        <td>资源描述：</td>  <td   style=" margin-left: 80px;"><input  style=" margin-left: 80px;"type="text"name="desc" value="${requestScope.upload.videoDescrtion}"></td>
                </tr><tr>
                        <td>上传时间：</td>   <td  style=" margin-left: 80px;"><input  style=" margin-left: 80px;"type="text" name="uptime" value="${requestScope.upload.videoUploadTime}"></td>
                </tr><tr>
                        <td>观看消耗：</td>   <td style=" margin-left: 80px;"><input  style=" margin-left: 80px;" name="consume" type="text" id="consume" /></td>
                    </tr>
                        <tr>
                    <td style=" margin-right: 80px;"></td>
                            <td  ><input style="margin-right:10%;font-size:larger " type="submit" value="审核通过" >
                                <input style="margin-left: 10%;font-size: larger " type="button" value="审核不通过" onclick="del(${upload.videoId})" ></td>
                        </tr>
                    </form>
                </table>
            </div>
        </div>
    </div>
    <div class="btmbg">
        <div class="btm">
            <div >
                <div>
                    <span>关于我们</span>
                    <span>联系我们</span>
                    <span>诚聘英才</span>
                    <span>商务合作</span>
                    <span>常见问题</span>
                </div>
                <div>
                    备案许可号：赣ICP备08666666号
                    <a target="_blank">赣公网安备 000000000000号</a>
                    <span>出版经营许可证</span>
                </div>
                <div>
                    <span>运营公司：江西i学习教育咨询有限公司</span>
                    <span>法律顾问：张律师</span>
                </div>
                <div>
                    Ixuexi,All Rights Reserved.版权所有 i学习
                </div>
            </div>
        </div>
    </div>

    <script type="text/javascript">
        function del(id) {
            if(confirm("确认删除么"))
            {
                $.ajax({
                    type:"post",
                    data:id,
                    datatype:"json" ,
                    url:"/upload?action=deleteUpload",
                    processData: false,
                    contentType: false,
                    async:true,
                    success:function(result){
                        alert(result.message)
                        if(result.status === 1){
                            window.location.reload();
                        }
                    }});
            }
        }
        function upload11() {
            var formData = new FormData();
            var file = document.getElementById('picture').files[0];
            formData.append("file", file);
            $.ajax({
                type:"post",
                data:formData,
                datatype:"json" ,
                url:"audit?name="+$("#name").val(),
                processData: false,
                contentType: false,
                async:true,
                success:function(result){
                    $("#uplo").attr("enctype","application/x-www-form-urlencoded");
                }});
        }

    </script>
</div>
</body>
</html>